package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppVoiceRecognition;
import com.ep.modules.app.service.AppVoiceRecognitionService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/voice_recognition")
public class AppVoiceRecognitionController {
    @Autowired
    private AppVoiceRecognitionService appVoiceRecognitionService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appVoiceRecognitionService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppVoiceRecognition appvoicerecognition = appVoiceRecognitionService.getById(id);
        return R.ok().put("appvoicerecognition", appvoicerecognition);
    }

    @SysLog("保存AppVoiceRecognition")
    @PostMapping("/save")
    public R save(@RequestBody AppVoiceRecognition appvoicerecognition) {
        ValidatorUtils.validateEntity(appvoicerecognition);
        appVoiceRecognitionService.save(appvoicerecognition);
        return R.ok();
    }

    @SysLog("修改AppVoiceRecognition")
    @PostMapping("/update")
    public R update(@RequestBody AppVoiceRecognition appvoicerecognition) {
        ValidatorUtils.validateEntity(appvoicerecognition);
        appVoiceRecognitionService.update(appvoicerecognition);
        return R.ok();
    }

    @SysLog("删除AppVoiceRecognition")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appVoiceRecognitionService.deleteBatch(ids);
        return R.ok();
    }
}